https://leetcode.cn/problems/kth-largest-element-in-a-stream/
class KthLargest {
public:
    int _k;
    priority_queue<int,vector<int>,greater<int>> heap;
    
    KthLargest(int k, vector<int>& nums) {
        _k=k;
        for(auto x:nums)
        {
            heap.push(x);
            if(heap.size()>_k)
                heap.pop();
        }        
    }
    
    int add(int val) {
        heap.push(val);
        if(heap.size()>_k)
            heap.pop();

        return heap.top();
    }
};
